
import CommonModal from "@/components/CommonModal";
import { Alert, Button } from 'antd';

const svg = <svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>

export default ({ tipsMsg, handleOk }) => {

  const renderErrorMsg = () => {
    const { type, reason } = tipsMsg;
    if (type == 1) {
      return (<>
        <div className="common-color9" style={{ fontSize: '15px', display: 'flex', alignItems: "center", paddingLeft: '8px' }}>{svg}&nbsp;识别失败</div>
        <p style={{  padding: '2px 0 0 28px' }}>{reason}</p>
      </>)
    } else if (type == 2) {
      return (<>
        <Alert message="资料提交中" type="success" showIcon />
        <div style={{ fontSize: '15px',  paddingLeft: '15px '}}>
          <p>银行正在验证资料，请等待几秒，不要退出！</p>
          <p>中途退出可能造成提交失败！</p>
          <div style={{display:'flex', justifyContent:'center', margin: '12px 0 24px 0'}}><img src="https://imgniu.zhaojiafang.com/front-web/ERP/shalou.gif" alt="" style={{ width: '146px' }} /></div>
        </div>
      </>)
    } else if(type == 4) {
        return (<>
            <div className="common-color9" style={{ fontSize: '15px', display: 'flex', alignItems: "center", paddingLeft: '8px' }}>{svg}&nbsp;实名认证验证失败</div>
            <p style={{  padding: '2px 0 0 28px' }}>{reason}</p>
          </>) 
    } else {
      return (<>
        <div className="common-color9" style={{ fontSize: '15px', display: 'flex', alignItems: "center", paddingLeft: '8px' }}>{svg}&nbsp;身份资料验证失败</div>
        <p style={{ padding: '2px 0 0 28px' }}>原因为：{reason}</p>
      </>)
    }
  }

  return (
    <CommonModal
      visible={true}
      title={'温馨提示'}
      width={416}
      minHeight={116}
      closable={tipsMsg.type != 2}
      onCancel={handleOk}
      footer={tipsMsg.type == 2 ? null : <Button type="primary" onClick={handleOk}>知道了</Button>}
    >
        {renderErrorMsg()}
    </CommonModal>
  )
}